<html xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui" >  

    <ui:composition template="layout.xhtml">
        <ui:define name="corpo">
            <h:form id="buscar_form" acceptcharset="utf-8"> 
                <div id="breadcrumb">
                    <p:commandLink  actionListener="#{managerIndex.redirect('index.xhtml')}" value="Inicio" update="@form" immediate="true"/> >
                    <p:commandLink  actionListener="#{managerIndex.redirect('config.xhtml')}" value="Configurações" update="@form" immediate="true"/> >
                    <p:commandLink  actionListener="#{managerIndex.redirect('indexTipoSelo.xhtml')}" value="Tipo Selo" update="@form" immediate="true"/> >
                    <p:commandLink  value="Buscar Tipo Selo" update="@form" immediate="true"/>
                </div>
                <p:panel header="Pesquisar Tipo Selo">
                    <p:messages showDetail="true"  id="msg" /> 
                    <h:panelGrid columns="2" id="panelGridEscolha" styleClass="textAlignRight" columnClasses="textAlignRight">
                        <h:outputText value="Nome : " />
                        <p:inputText  value="#{managerConsultarTipoSelo.tipoSelo.nome}" size="30" />

                        <h:outputText value="Descrição : " />
                        <p:inputText  value="#{managerConsultarTipoSelo.tipoSelo.descricao}" size="30" />
                   </h:panelGrid>
                    
                    <div class="buttonAction">
                        <p:commandButton value="Buscar" icon="ui-icon-search" 
                                         actionListener="#{managerConsultarTipoSelo.buscarTipoSelo()}" 
                                         update="@form, tipoTable, msg"/>
                        
                        <p:commandButton id="limpar" icon="ui-icon-arrowreturnthick-1-w" 
                                         value="Cancelar" 
                                         actionListener="#{managerVisualizarTipoSelo.redirect('indexTipoSelo.xhtml')}" 
                                         immediate="true" />
                    </div>
                    <br/>
                    <p:dataTable id="tipoTable" var="tipo" value="#{managerConsultarTipoSelo.tipoSelos}" 
                                 paginator="true" rows="5"
                                 paginatorPosition="bottom"
                                 styleClass="table-result-search"
                                 paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"  
                                 rowsPerPageTemplate="5,10,15"
                                 emptyMessage="Nenhum Registro Encontrado">     
                        <f:facet name="header">  
                            Dados do Tipo Selo
                        </f:facet>
                        <p:column  style="width:200px;">  
                            <f:facet name="header" >   
                                Nome
                            </f:facet>  
                            <h:outputText value="#{tipo.nome}" />  
                        </p:column>
                        <p:column  style="width:300px;">  
                            <f:facet name="header" >   
                                Descrição
                            </f:facet>  
                            <h:outputText value="#{tipo.descricao}" />  
                        </p:column>

                        <p:column style="width:80px;">  
                            <f:facet name="header" >   
                                Cor
                            </f:facet> 
                            <table >
                                <tr >
                                    <td style="width: 40px; background-color: \##{tipo.corSelo.cor};">
                                    </td>
                                    <td style="text-align:center;">
                                        <h:outputText value="#{tipo.corSelo.descricao}"/>
                                    </td>
                                </tr>
                            </table> 

                        </p:column>


                        <p:column style="width:50px;">  
                            <f:facet name="header">  
                                <h:outputText value="Opções" />   
                            </f:facet>
                            <p:commandButton  icon="editar" actionListener="#{managerEditarTipoSelo.redirect('editarTipoSelo.xhtml', tipo)}" update="@form"/> 
                            <p:commandButton  icon="view" actionListener="#{managerVisualizarTipoSelo.redirect('visualizarTipoSelo.xhtml',tipo)}" update="@form"/>
                        </p:column>   

                    </p:dataTable>    
                </p:panel>
                <br/>
            </h:form>
        </ui:define>
    </ui:composition>
</html>
